<template>
    <div class="box">
        <h3>资讯管理</h3>
        <div class="wrap">
            <p><span>搜索：</span><input type="select" placeholder="资讯名称">
                <span>状态：</span><input type="select" placeholder=""><button>查询</button><button>新增</button></p>
            <table>
                <tr>
                    <th>序号</th>
                    <th>文章标题</th>
                    <th>创建人</th>
                    <th>创建日期</th>
                    <th>状态</th>
                    <th>操作</th>
                    
                </tr>
                <tr v-for="(item,index) in list" :key="index">
                    <td>{{ item.id }}</td>
                    <td>{{ item.order }}</td>
                    <td>{{ item.name }}</td>
                    <td>{{ item.phone }}</td>
                    <td>{{ item.type }}</td>
                    <td><span>查看</span> <span>编辑</span> <span>删除</span></td>
                </tr>

            </table>
        </div>
    </div>
</template>

<script>
import axios from "axios";
export default {
   data(){
      return{
        list:[]
      }
   },
   methods: {
    getList() {
        axios.get('/api/list').then((res)=>{
            console.log(res);
            this.list=res.data
        })
    },
   },
   mounted() {
     this.getList()
   },
}
</script>

<style lang="scss" scoped>
* {
    margin: 0;
    padding: 0;
}

.box {
    width: 100%;
    height: 100%;
    background-color: rgb(245,245,245);
    h3{
        margin-left: 15px;
        margin-top: 20px;
    }
    .wrap{
        
        width: 97%;
        height: 90%;
        background-color: white;
        margin-left: 20px;
        p{
            height: 50px;
            padding-top: 20px;
            input{
                width: 200px;
                height: 25px;
            }
            span{
                display: inline-block;
                margin-left: 30px;
            }
            button{
                width: 60px;
                height: 30px;
                margin-left: 10px;
                background-color: rgb(153,153,153);
                border: none;
                color: white;
            }
        }
    }
}

table {
    margin-left: 20px;
    width: 1300px;
    // height: 400px;
    border: 1px solid #ccc;
    border-collapse: collapse;

    th {
        background-color: rgb(242,242,242);
        height: 40px;
    }

    td {
        // width: 100px;
        height: 45px;
        border: 1px solid #ccc;
        text-align: center;
    }
}</style>

